<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderItemsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_items', function (Blueprint $table) {
            $table->id();
            $table->integer('order_id')->unsigned()->comment('订单id');
            $table->integer('good_id')->unsigned()->comment('商品id');
            $table->integer('base_price')->unsigned()->default(0)->comment('商品零售价');
            $table->integer('pay_price')->unsigned()->default(0)->comment('商品实付价');
            $table->integer('jf')->unsigned()->default(0)->comment('商品积分');
            $table->string('good_title', 100)->default('')->comment('商品名称');
            $table->string('good_logo', 100)->default('')->comment('商品主图');
            $table->integer('goods_quantity')->unsigned()->default(0)->comment('数量');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `order_items` comment '订单子表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_items');
    }
}
